public class MainMenu {
  PImage img;
  ArrayList<Button> subjects;
  float picscalex;
  float picscaley;
  String switchTo;

  public MainMenu() {
    img = loadImage("menu.png");  
    picscalex = (1.0 * screenWidth)/img.width;
    picscaley = (1.0 * screenHeight)/img.height; 
    img.resize(screenWidth, screenHeight);
    background(img);
    subjects = new ArrayList<Button>();
    subjects.add(new Button(picscalex*70, picscaley*60, picscalex*170, picscaley*120, "Physics"));
    subjects.add(new Button(picscalex*70, picscaley*307, picscalex*170, picscaley*120, "Chemistry"));
    subjects.add(new Button(picscalex*363, picscaley*60, picscalex*170, picscaley*120, "Math"));
    subjects.add(new Button(picscalex*363, picscaley*307, picscalex*170, picscaley*120, "English"));
    subjects.add(new Button(picscalex*647, picscaley*60, picscalex*170, picscaley*120, "Biology"));
    subjects.add(new Button(picscalex*647, picscaley*307, picscalex*170, picscaley*120, "History"));
  }

  public void mouseAct(float x, float y) {
    for (Button b : subjects) {
      if (b.isClicked(x, y)) {
        switchTo = b.data;
      }
    }
  }
}

